<%--
  Created by IntelliJ IDEA.
  User: 杨璞
  Date: 2017/12/7
  Time: 13:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<html>
<head>
    <title><fmt:message code="main.workmonitor"/></title>
    <meta charset="UTF-8">
    <%--<meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />--%>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <%--<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">--%>
    <link rel="stylesheet" type="text/css" href="/css/main/theme3/fontawesome5.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/workflow/m_reset.css">
	<link rel="stylesheet" type="text/css" href="/css/main/theme3/fontawesome5.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/workMonitor.css?20191219">
    <link rel="stylesheet" href="../../css/officialDocument/officialDocument.css">
    <link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
    <link rel="stylesheet" type="text/css" href="/css/base/base.css?20201106.1" />
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../../css/workflow/work/handle.css"/>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <script>

        function getCookie(name)
        {
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
            if(arr=document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }

        var oHead = document.getElementsByTagName('HEAD').item(0);

        var oScript= document.createElement("script");
        var type = getCookie("language");
        oScript.type = "text/javascript";

        if(type){
            oScript.src="/js/Internationalization/"+type+".js";
        }else{
            oScript.src="/js/Internationalization/zh_CN.js";
        }
        oHead.appendChild( oScript);

    </script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="../../js/workflow/work/workform.js"></script>
    <script src="/js/workflow/work/workMonitor.js?201912151"></script>
    <script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>

    <style>
        input{
            float:none;
            border:1px solid #ccc;
        }
        .workMon {
            font-size: 22px;
            font-weight: normal;
            line-height: 45px;
            float: none;
            margin-top: 9px;
            font-size: 22px;
            color: #333;
        }
        .flowNum, .artNum, #user {
            width: 100px;
        }
        #query{
            background: #00a0e9 !important;
        }
        .sms-bg-static{
            background: #d2d2d2 url("/img/images/sms-static.png") no-repeat left center;
        }
        .sms-bg-static.active{
            background: #3691da url(/img/images/sms.png) no-repeat left center;
        }
        .email-bg-static{
            background: #d2d2d2 url(/img/images/email-static.png) no-repeat left center;
        }
        .email-bg-static.active{
            background: #3691da url(/img/images/email.png) no-repeat left center;
        }
        .sms-check, .email-check, .mobile-check{
            width: 88px;
            height: 30px;
        }
        .userSelectBtn:hover {
            background: url(../../img/userSelectBtnhover.png) no-repeat -3px -2px;
        }
        .layui-layer-btn-{
            /*border-top: 1px solid #d6d6d6;*/
            /*background-color: #f6f6f6;*/
        }
        /*.prcsName h1 {*/
        /*    text-align: center;*/
        /*    line-height: 35px;*/
        /*}*/
        .layui-layer-page .layui-layer-content {
            overflow-x: hidden !important;
        }
        .layui-layer-title{
            color: #fff;
            font-size: 16px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            background:linear-gradient(to bottom,#2077c6,#2495df);
            FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0, startColorStr=#2077c6, endColorStr=#2495df);
            background: -ms-linear-gradient(top, #2077c6, #2495df);        /* IE 10 */
            background:-moz-linear-gradient(top, #2077c6, #2495df);/*火狐*/
            background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#2077c6), to(#2495df));  /* Safari 4-5, Chrome 1-9*/
            background: -webkit-linear-gradient(top, #2077c6, #2495df);   /*Safari5.1 Chrome 10+*/
            background: -o-linear-gradient(top, #2077c6, #2495df);  /*Opera 11.10+*/
            linear-gradient(to bottom, hsl(0, 80%, 70%), #2077c6); /* Standard syntax; must be last */
        }
        .xuanzhong1{
            left: 193px;
        }
        .work-prcs-title,.work-msg-title{
            background-color: #d6e7f8;
            color: #023964;
            font-size: 14px;
            position: relative;
        }
        /*.prcsName_chang{*/
        /*    border: none;*/
        /*    color:#fff;*/
        /*    background: #3691da  url("../../../img/workflow/work/add_work/checked.png") no-repeat 20px center;*/
        /*}*/
        .user-tags{
            background: #fff;
        }
        .cytitle{
            position: absolute;
            left: 15px;
            font-size: 14px;
            color: #023964;
            top: 30px;
        }
        .feedbacktitle {
            position: relative;
            top: 3px;
            font-weight: bold;
            margin-left: 10px;
            color: #333333;
        }
        .feedbackcontent {
            margin-left: 23px;
            font-size: 15px;
            color: #333333;
        }
        .backinfo {
            width: 100%;
            height: 100px;
        }

        .sel{
            width:158px;
            max-height:250px;
            position: absolute;
            top:21px;
            left:64px;
            overflow: auto;
            background: #fff;
            border:1px solid #e2e3e3;
            display: none;
        }
        .sel li{
            line-height: 24px;
            color: #000;
        }
        #list{
            width:40px;
            height:30px;
            background: #f3f3f3;
            border:1px solid #ccc;
            vertical-align: middle;
            position: absolute;
            right: 0px;
            top: -8px;
            border-radius: 0px 3px 3px 0px;
        }
        #list img{
            margin-top: -2px;
            margin-left: 0px;
        }
        .canchoose:hover{
            background: #2b7edf;
            color: #fff;
            cursor: pointer;

        }
        input[name="flowName"]{
            width:150px;
            height:28px;
            border-radius: 3px;
            margin-top: -6px;
        }
        #query:hover {
            background-color: #3b8eef !important;
        }
        #outport {
            margin-left: 10px;
            color: #ffffff;
            cursor: pointer;
            border-radius: 5px;
            width: 80px;
            height: 30px;
            background-color: #0cae32 !important;
            border: 1px solid #0cae32;
        }
        #outport:hover {
            background-color: #17bb3e !important;
            border: 1px solid #17bb3e !important;
        }
        .pagediv .page-top-inner-layer table th:nth-child(1),.pagediv .page-bottom-outer-layer table td:nth-child(1){
            text-align: left;
        }
        .pagediv .page-bottom-outer-layer table td{
            padding:0px 4px;
            font-size:10pt;
        }
        .pagediv .page-bottom-outer-layer table td:nth-child(2){
             text-overflow: clip;
             white-space: normal;
         }
        .pagediv .page-bottom-outer-layer table td:nth-child(3){
            text-overflow: clip;
            white-space: normal;
        }

        .pagediv .page-top-inner-layer table th{
            font-size:12pt;
            line-height: 30px;

        }
        .pagediv .page-top-inner-layer{
            height:40px;
        }
        .prcsName{
            cursor:pointer;
        }

        /*工作监控列表操作按钮模板 复制到需要的页面文件中 开始*/
        
        .editAndDelete0,
        .editAndDelete1,
        .editAndDelete2,
        .editAndDelete3,
        .editAndDelete4,
        .editAndDelete5 {
            margin-right: 10px;
            margin-bottom: 5px;
            margin-top: 5px;
            font-size: 12px;
            padding: 6px;
            border-radius: 3px;
            background-color: #2b7edf;
            color: #fff !important;
        }
    
        .editAndDelete4 {
            background-color: #ef4747;

        }
        .editAndDelete5 {
            background-color: #ef4747;
            
        }

        
        /*只要修改content值*/
        /*查看：f865
          删除或者回收等：f2ed
          传阅：f5da 
          转交：f4c6
          委托：f4c4
          催办：f7e4
          结束：f895
        */

        
        .editAndDelete0:before {
            content: "\f865";
        }
        .editAndDelete1:before {
            content: "\f04a";
        }
        .editAndDelete2:before {
            content: "\f5da";
        }
        .editAndDelete3:before {
            content: "\f7e4";
        }
        .editAndDelete4:before {
            content: "\f895";
        }
        .editAndDelete5:before {
            content: "\f2ed";
        }


        .editAndDelete0:before,
        .editAndDelete1:before,
        .editAndDelete2:before,
        .editAndDelete3:before,
        .editAndDelete4:before,
        .editAndDelete5:before {
            font-family: "Font Awesome 5 Pro";
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            display: inline-block;
            font-style: normal;
            font-variant: normal;
            font-weight: 300;
            line-height: 1;
            margin-right: 4px;
        }
        /*工作监控列表操作按钮模板 复制到需要的页面文件中 结束*/

    </style>
</head>
<body>
    <div class="mainCon">
        <div class="header" style="background-color:white ">
            <div class="title">
                <img src="/img/commonTheme/${sessionScope.InterfaceModel}/gongzuojiankong.png" alt="" style="margin-bottom:10px;">
                <h3 style="display:inline;" class="workMon"><fmt:message code="main.workmonitor"/></h3>
            </div>
        </div>
        <div class="section">
            <div class="selectNav" style="padding-top: 63px;padding-bottom: 13px">
                <%--<div style="position: relative">--%>
                    <label style="position: relative"><fmt:message code="workflow.th.processname"/>：
                        <input type="text" name="flowName" placeholder="全部流程" dataType="" style="width: 150px;padding-left: 5px">
                        <button id="list"><img src="../../img/workflow/work/xiala.png" alt=""></button>
                        <ul class="sel"></ul>
                    </label>

                <%--</div>--%>

                <%--<select name="flowId" id="flowName" style="width: 130px;">--%>
                    <%--&lt;%&ndash;<option value=""><fmt:message code="workflow.th.wholeprocess"/></option>&ndash;%&gt;--%>
                <%--</select>--%>
                <label style="margin-left: 10px"><fmt:message code="workflow.th.liushui"/>：</label>
                <input type="text" class="flowNum" name="runId">
                <label style="margin-left: 10px"><fmt:message code="workflow.th.job"/>：</label>
                <input type="text" class="artNum" name="runName" value="">

            </div>
            <div style="padding-bottom: 15px;">
                <label style="margin-left: 32px"><fmt:message code="work.th.priority"/>：</label>
                <select id="first" name="workLevel" style="display:none">
                    <option value=""><fmt:message code="notice.th.all"/></option>
                    <option value="2"><fmt:message code="sup.th.urgent"/></option>
                    <option value="0"><fmt:message code="sup.th.ordinary"/></option>
                </select>
                <select id="flowUser" name="status">
                    <option value="1"><fmt:message code="workflow.th.ProcessInitiator"/></option>
                    <option value="2"><fmt:message code="ending.th.CurrentTransactor"/></option>
                </select>
                <input type="text" id="user" name="userId" user_id="" readonly>
                <a href="javascript:;" id="addUser" style="margin-left: 10px;color: #2b7fe0;"><fmt:message code="notice.th.chose"/></a>
                <a href="javascript:;" id="clearUser" style="color: #2b7fe0;margin-left: 5px;"><fmt:message code="global.lang.empty"/></a>
                <button id="query" style="margin-top: 5px;margin-left: 13px">
                    <%--<img src="../../img/workflow/worksearch.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">--%>
                    <img src="../../img/workflow/worksearch1.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">
                    <span style="margin-right: 5px;"><fmt:message code="global.lang.query"/></span>
                </button>
                <button id="outport" style="margin-top: 5px">
                    <%--<img src="../../img/workflow/workdc.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">--%>
                    <img src="../../img/workflow/workdc1.png" style="margin-right: 2px;margin-left:5px;margin-bottom: 1px;">
                    <span style="margin-right: 5px;"><fmt:message code="global.lang.report"/></span>
                </button>
            </div>
        </div>

        <div id="pagediv">

        </div>
    </div>
</body>
</html>
<script>
    var eventas;
    window.onresize = function(){
        var screenwidth = document.documentElement.clientWidth;
        if (screenwidth  > 1250) {
            var nums = screenwidth * 0.97;
            var sumwidth = screenwidth * 0.97 + 'px';
        } else {
            var nums = 1200;
            var sumwidth = '1200px';
        }
        pageObj.configuration[0]['width'] = nums * 0.072 + 'px';
        pageObj.configuration[1]['width'] = nums * 0.1125 + 'px';
        pageObj.configuration[2]['width'] = nums * 0.2325 + 'px';
        pageObj.configuration[3]['width'] = nums * 0.1133 + 'px';
        pageObj.configuration[4]['width'] = nums * 0.1133 + 'px';
        pageObj.configuration[5]['width'] = nums * 0.125 + 'px';
        pageObj.configuration[6]['width'] = nums * 0.185 + 'px';

        $('.page-top-outer-layer').css('width',sumwidth).find('table').css('width',sumwidth);
        for(var i=0;i< $('.page-top-outer-layer').find('th').length;i++){
            $('.page-top-outer-layer').find('th').eq(i).css('width',pageObj.configuration[i]['width']);
        }
        $('.page-bottom-outer-layer').css('width',sumwidth).find('.page-bottom-inner-layer').css('width',sumwidth).find('table').css('width',sumwidth);
        var table = $('.page-bottom-outer-layer .page-bottom-inner-layer table');
        for(var i=0;i<table.find('tr').length;i++){
            for(var j=0;j<table.find('tr').eq(i).find('td').length;j++){
                table.find('tr').eq(i).find('td').eq(j).css('width',pageObj.configuration[j]['width']);
            }
        }
    };
    var screenwidth = document.documentElement.clientWidth;
    if (screenwidth  > 1250) {
        var nums = screenwidth * 0.97;
        var sumwidth = screenwidth * 0.97 + 'px';
    } else {
        var nums = 1200;
        var sumwidth = '1200px';
    }
    var width0 = nums * 0.072 + 'px';
    var width1 = nums * 0.1125 + 'px';
    var width2 = nums * 0.2325 + 'px';
    var width3 = nums * 0.1133 + 'px';
    var width4 = nums * 0.1133 + 'px';
    var width5 = nums * 0.125 + 'px';
    var width6 = nums * 0.185 + 'px';
    var pageObj=$.tablePage('#pagediv',sumwidth,[
        {
            width:width0,
            title:'<fmt:message code="workflow.th.liushui"/>',
            name:'runId',
            selectFun:function(runId,obj){

                if(obj.handleTime == '未接收'){
                    return '<img class="headli1_2_icon" src="../../img/workflow/work/nowork.png" alt="" style="margin-top: -3px">&nbsp;<span class="color" style="color:#0cae32" name="'+runId+'">'+runId+'</span>';
                }else{
                    return '<img class="headli1_2_icon" src="../../img/workflow/work/waitwork.png" alt="" style="margin-top: -3px">&nbsp;<span class="color" style="color:#0cae32" name="'+runId+'">'+runId+'</span>';
                }
            }
        },
        {
            width:width1,
            title:'<fmt:message code="workflow.th.processname"/>',
            name:'flowName',
            selectFun:function (flowName,obj) {
                return '<a class="wenhao" style="cursor: pointer;" onclick="jumpOpenType('+obj.flowId+',type=0)">'+flowName+'</a>';
            }
        },
        {
            width:width2,
            title:'<fmt:message code="workflow.th.job"/>',
            name:'runName',
            selectFun:function (runName,obj) {
                return '<a class="wenhaoTwo" style="cursor: pointer;" flowId="'+ obj.flowId+'" runId="'+ obj.runId+'" prcsId="'+ obj.runId +'" tableName="'+obj.sortMainType+'" onclick="jumpOpenName(this,'+obj.flowId+','+obj.prcsId+','+obj.runId+','+obj.flowPrcs+')">'+runName+'</a>';
            }
        },
        {
            width:width3,
            title:'<fmt:message code="attend.th.CurrentStep"/>',
            name:'prcsName',
            selectFun:function (prcsName,obj) {
                return '<a class="wenhao" style="cursor: pointer;" onclick="jumpOpenStep('+obj.flowId+','+obj.runId+',this)">'+prcsName+'</a>';
            }
        },{
            width:width4,
            title:'<fmt:message code="ending.th.CurrentTransactor"/>',
            name:'userName',
        },{
            width:width5,
            title:'<fmt:message code="work.th.shouTime"/>',
            name:'handleTime',
            selectFun:function (handleTime,obj) {
                return '<div>'+obj.prcsTime+'</div><div>'+handleTime+'</div>';
            }
        },
        {
            width:width6,
            title:'<fmt:message code="notice.th.operation"/>',
        }
    ],function (me){
        me.data.pageSize = 15;
        me.init('../../workflow/work/monitoring',[
            <%--{name:'<fmt:message code="workflow.th.Transfer"/>',fn:function(obj){--%>
            <%--return 1;--%>
        <%--}},--%>
        {name:'转交',fn:function(obj){
            return 1;
        }},{name:'回退',fn:function(obj){
            if(obj.allowBack=='1' || obj.allowBack=='2'){
                if(obj.prcsId != 1){
                    return 1;
                }
            }else{
                return 0;
            }
        }}, {name:'<fmt:message code="workflow.th.Entrust"/>',fn:function(obj){
            return 1;
        }},{name:'<fmt:message code="main.th.Reminders"/>',fn:function(obj){
            return 1;
        }},{name:'<fmt:message code="meet.th.End"/>',fn:function(obj){
            return 1;
        }},{name:'<fmt:message code="menuSSetting.th.deleteMenu"/>',fn:function(obj){
            return 1;
        }}/*,{name:'退回',fn:function(obj){
           if(obj.allowBack=='1' || obj.allowBack=='2'){
               return 1;
           }else{
               return 0;
           }
        }}*/],function(res){
            var data = res.obj;

            var arr=[];
            for(var i=0;i<data.length;i++){
                if((i+1)<data.length){
                    if(data[i].runId == data[(i+1)].runId && data[i].runId != undefined && data[i+1].runId != undefined){
                        arr.push(data[i].runId)
                    }
                }
            }
            for(var j = 0;j<$('.color').length;j++){
                for(var m=0;m<arr.length;m++){
                    if($('.color').eq(j).attr('name') == arr[m]){
                        $('.color').eq(j).css('color','purple')
                    }
                }
            }
        })
    })

    $(document).click(function(){
        $('.sel').hide()
    })

    $('#list').click(function(e){
        e.stopPropagation()
        if( $('.sel').css('display')!='none'){
            $('.sel').hide()
        }else{
            $('.sel').show()
        }

    })
    $('[name="flowName"]').keyup(function(){
        $('.sel').show()
        var val=$(this).val()
        $('.sel li').each(function(i,v){
            if(v.innerHTML.indexOf(val)>-1){
                $(v).show();
                $(v).parent().show()
            }else{
                $(v).hide();
            }
        })

    })

    $('.sel').on('click','li',function(e){
        e.stopPropagation()
        if($(this).attr('value')){
            $('[name="flowName"]').val($(this).html())
            $('[name="flowName"]').attr('dataType',$(this).attr('value'))
            $('.sel').hide()
        }else{
            $('.sel').show()
        }
    })

    function buildNode(len,data){
        var prefix = 10;
        for(var i=0;i<len;i++){
            prefix += 10;
        }

        $.each(data,function(i,item){
            if(0 < item.childs.length){
                $('.sel').append("<li style='padding-left:"+(prefix)+"px;font-weight:bold;font-size:14px;' id="+item.sortId +">" + item.sortName + "<li>");
                $.each(item.flowTypeModels,function(j,v){
                    $('.sel').append("<li style='padding-left:"+(prefix+10)+"px;cursor:pointer' class='canchoose' value="+v.flowId +">" +  v.flowName + "<li>");
                })
                buildNode(len+1,item.childs);
            }else{
                $('.sel').append("<li style='padding-left:"+(prefix)+"px;font-weight:bold;font-size:14px;' id="+item.sortId +">" + item.sortName + "<li>");
                $.each(item.flowTypeModels,function(j,v){
                    $('.sel').append("<li style='padding-left:"+(prefix+10)+"px;cursor:pointer' class='canchoose' value="+v.flowId +">" +  v.flowName + "<li>");
                })
            }
        });
    }

    $(function(){
        $.ajax({
            url:"/flow/selOneToAllType",
            type:'post',
            dataType:'json',
            success:function(res){
                var data=res.datas;
                var str='<option value=""><fmt:message code="hr.th.PleaseSelect"/></option>';
                if(res.flag){
                    $.each(data,function(i,item){
                        $('.sel').append("<li class='ones' style='font-weight:bold;font-size:14px;' id="+item.sortId +"><img src='../../img/data_points.png' style='margin-right: 5px;    margin-top: 0px;' alt=''>" + item.sortName + "<li>");
                        $.each(item.flowTypeModels,function(j,v){
                            $('.sel').append("<li style='padding-left:10px;cursor:pointer' class='canchoose' value="+v.flowId +">" +v.flowName + "<li>");
//                                $('[name="dispatchType"]').append("<option value="+v.flowId +">" + + "</option>");
                        })
                        buildNode(1,item.childs);
                    });
                }
//                $('[name="flowId"]').html(str);
            }
        })
    })

    function checkPrcIn(e,dataobj,attributes,prcsIn,prcsInSet,conditionDesc,formdata,fromDataReject,cb){
        if(conditionDesc!=undefined&&conditionDesc.indexOf('\n')>=0){
            var msg = conditionDesc.split('\n')[1];
        }else{
            var msg = conditionDesc;
        }

        var res = {
            flag:true,
            msg:''
        };
        if(msg){
            res.msg = msg;
        }else{
            res.msg =  '<fmt:message code="main.th.NonConformity" />'
        }

        var arrtest = [];
        if(prcsIn.indexOf('\n')>=0){
            var prcsInArr = prcsIn.split('\n');
        }else{
            var prcsInArr = [prcsIn];
        }


        for(var i=0;i<prcsInArr.length;i++){
            if(prcsInArr[i]){
                arrtest.push(prcsInArr[i])
            }
        }
        if(arrtest.length == 1 && prcsInSet == ''){
            prcsInSet='[1]';
        }
        if(prcsInSet != ""){

            formdata = covertToFormData(formdata);

            prcsInArr.forEach(function(v,i){

                if(v){

                    var check_pass = 0;
                    var titleValue = '';
                    if(v.indexOf("'") > -1){

                        var arr_rule = v.split("'");

                        var item_title = myTrim(arr_rule[1]);
                        var item_con = myTrim(arr_rule[2]);
                        var item_value = myTrim(arr_rule[3]);
                        var item_pag = $(e).find('[Id="'+fromDataReject[item_title]+'"]')
                        titleValue = formdata[fromDataReject[item_title]];

                        if(v.indexOf('[')<=-1){
                            if(item_pag.attr('data-type')=='macros'&&item_pag.attr('datafld')=='SYS_USERNAME'&&item_pag.attr('orgsignImg')==1){
                                if(item_pag.prev().find('img').attr('src')!=undefined&&item_pag.prev().find('img').attr('src')!=''&&item_pag.prev().find('img').attr('src').indexOf('AID')>=0){
                                    titleValue = item_pag.prev().find('img').attr('src');
                                }else{
                                    titleValue = formdata[fromDataReject[item_title]];
                                }
                            }else if(fromDataReject[item_title]&&$('#'+ fromDataReject[item_title] +'').attr('data-type') == 'userselect'){
                                var str = $('#'+ fromDataReject[item_title] +'').val();
                                titleValue = str.substr(0,str.length-1);
                            }else{
                                titleValue = formdata[fromDataReject[item_title]];
                            }

                        }else{
                            if(item_title == '[当前步骤号]' || item_title == '[CUR_PRCS_ID]'){
                                titleValue = dataobj.prcsId
                            }else if(item_title == '[当前主办人姓名]' || item_title == '[CUR_USER_NAME]'){
                                titleValue = dataobj.userName.split('：')[1];
                            }else if(item_title == '[公共附件名称]' || item_title == '[ATTACH_NAME]'){
                                titleValue = '';
                                for(var j=0;j<$(e).find('#oneUploadFile .item_wordH1').length;j++){
                                    if($(e).find('#oneUploadFile .item_wordH1').length ==1){
                                        titleValue = GetFileNameNoExt($(e).find('#oneUploadFile .item_wordH1').eq(j).attr('title'))
                                    }else{
                                        titleValue += GetFileNameNoExt($(e).find('#oneUploadFile .item_wordH1').eq(j).attr('title')) + ','
                                    }
                                }
                            }else if(item_title == '[公共附件个数]' || item_title == '[ATTACH_COUNT]'){
                                titleValue = $(e).find('#oneUploadFile .item_wordH1').length;
                            } else if(item_title == '[当前流程设计步骤号]' || item_title == '[CUR_FLOW_PRCS]'){
                                titleValue = dataobj.flowPrcs
                            } else if(item_title == '[当前主办人角色]' || item_title == '[CUR_USER_PRIV]'){
                                titleValue = attributes.sYS_USERPRIV;
                            }else if(item_title == '[当前主办人角色_辅助角色]' || item_title == '[CUR_USER_PRIV_OTHER]'){
                                var thisd = attributes.SYS_USERPRIVOTHER;
                                if(thisd.substr(thisd.length-1,thisd.length) == ','){
                                    thisd = thisd.substr(0,thisd.length-1);
                                }
                                titleValue = thisd;
                            }else if(item_title == '[当前主办人部门]' || item_title == '[CUR_USER_DEPT]'){
                                titleValue = attributes.SYS_DEPTNAME_SHORT;
                            }
                            // else if(item_title == '[当前主办人上级部门]' || item_title == '[CUR_USER_DEPT_PARENT]'){
                            //     titleValue = workForm.tool.getMacrosData('SYS_MANAGER2')()
                            // }else if(item_title == '[主办人会签意见]' || item_title == '[MAIN_USER_SIGN]'){
                            //     var data = globalData.sign;
                            //     titleValue=""
                            //     for(var j=0;j<data.length;j++){
                            //         if(data[j].opFlag == 1){
                            //             titleValue += data[j].content
                            //         }
                            //     }
                            // }else if(item_title == '[经办人会签意见]' || item_title == '[USER_SIGN]'){
                            //     var data = globalData.sign;
                            //     titleValue=""
                            //     for(var j=0;j<data.length;j++){
                            //         if(data[j].opFlag == 0){
                            //             titleValue += data[j].content
                            //         }
                            //     }
                            // }
                        }

                        //                           判断 第二个值是字段还是类型
                        if(fromDataReject[item_value]){//如果是字段并且是表单中字段的话
                            item_value = formdata[fromDataReject[item_value]];
                        }else{
                            if(item_value.indexOf('[')>-1){ //如果是字段并且不是表单中字段
                                if(item_value == '[当前步骤号]' || item_value == '[CUR_PRCS_ID]'){
                                    item_value = dataobj.prcsId
                                }else if(item_value == '[当前主办人姓名]' || item_value == '[CUR_USER_NAME]'){
                                    item_value = dataobj.userName.split('：')[1];
                                }else if(item_title == '[公共附件名称]' || item_title == '[ATTACH_NAME]'){
                                    item_value = item_value;
                                }else if(item_title == '[公共附件个数]' || item_title == '[ATTACH_COUNT]'){
                                    item_value = item_value;
                                }else if(item_value == '[当前流程设计步骤号]' || item_value == '[CUR_FLOW_PRCS]'){
                                    item_value = dataobj.flowPrcs
                                }else if(item_title == '[当前主办人角色]' || item_title == '[CUR_USER_PRIV]'){
                                    item_value = attributes.sYS_USERPRIV;
                                }else if(item_title == '[当前主办人角色_辅助角色]' || item_title == '[CUR_USER_PRIV_OTHER]'){
                                    var thisd = attributes.SYS_USERPRIVOTHER;
                                    if(thisd.substr(thisd.length-1,thisd.length) == ','){
                                        thisd = thisd.substr(0,thisd.length-1);
                                    }
                                    item_value = thisd;
                                }else if(item_title == '[当前主办人部门]' || item_title == '[CUR_USER_DEPT]'){
                                    item_value = attributes.SYS_DEPTNAME_SHORT;
                                }
                                // else if(item_value == '[当前主办人角色]' || item_value == '[CUR_USER_PRIV]'){
                                //     item_value = $.cookie('userPrivName')||workForm.tool.MacrosData.data.sYS_USERPRIV;
                                // }else if(item_value == '[当前主办人部门]' || item_value == '[CUR_USER_DEPT]'){
                                //     item_value = workForm.tool.getMacrosData('SYS_DEPTNAME_SHORT')()
                                // }else if(item_value == '[当前主办人上级部门]' || item_value == '[CUR_USER_DEPT_PARENT]'){
                                //     item_value = workForm.tool.getMacrosData('SYS_MANAGER2')()
                                // }else if(item_value == '[主办人会签意见]' || item_value == '[MAIN_USER_SIGN]'){
                                //     var data = globalData.sign;
                                //     item_value=""
                                //     if(data!=''&&data!=undefined){
                                //         for(var j=0;j<data.length;j++){
                                //             if(data[j].opFlag == 1){
                                //                 item_value += data[j].content
                                //             }
                                //         }
                                //     }
                                //
                                // }else if(item_value == '[经办人会签意见]' || item_value == '[USER_SIGN]'){
                                //     var data = globalData.sign;
                                //     item_value=""
                                //     if(data!=''&&data!=undefined){
                                //         for(var j=0;j<data.length;j++){
                                //             if(data[j].opFlag == 0){
                                //                 item_value += data[j].content
                                //             }
                                //         }
                                //     }
                                //
                                // }
                            }else{ //如果是类型值的话
                                if(item_value == '数值'){
                                    item_value = 'shu'
                                }else if(item_value == '日期'){
                                    item_value = 'date'
                                }else if(item_value == '时间+日期'){
                                    item_value = 'time';
                                }else{
                                    item_value = item_value;
                                }
                            }
                        }
                        if(titleValue == undefined){
                            res.msg = '条件设置有误，不存在“'+item_title+'”字段，请联系系统管理员前往流程设计器修改！';
                        }else{
                            check_pass = checkTileValue(titleValue,item_con,item_value);

                        }
                        check_pass = checkTileValue(titleValue,item_con,item_value);
                        var setitem =  (i+1)
                        var reg = new RegExp('\\['+setitem+'\\]',"g");//g,表示全部替换。

                        prcsInSet = prcsInSet.replace(reg,check_pass);
                    }


                }
            });
            prcsInSet = covertToPrcsOutSet(prcsInSet.toLowerCase());
            if(prcsInSet.indexOf('（') > -1 ||prcsInSet.indexOf('）') > -1){
                prcsInSet = prcsInSet.replace(/\（/g, "(").replace(/\）/g, ")");
            }
            var result = eval(prcsInSet);
            if(result == 0){
                res.flag = false;
            }
        }
        if(cb){
            cb(res);
        }
    };
    function myTrim(x) {
        if(x!=undefined){
            return x.replace(/^\s+|\s+$/gm,'');
        }
    };
    function covertToFormData(formdata){
        var data = {};
        if(formdata instanceof Array){
            formdata.forEach(function(v,i){
                data[v.key] =  v.value;
            });
        }
        return data;
    };

    function covertToPrcsOutSet(data){
        data = data.replace(/or/g,'||')
        data = data.replace(/and/g,'&&')
        return data;
    };

    function checkPrcOut(e,dataobj,attributes,prcsout,prcsoutSet,conditionDesc,formdata,fromDataReject,cb){

        if(conditionDesc!=undefined&&conditionDesc.indexOf('\n')>=0){
            var msg = conditionDesc.split('\n')[1];
        }else{
            var msg = conditionDesc;
        }
        var res = {
            flag:true,
            msg:""
        };
        if(msg){
            res.msg = msg;
        }else{
            res.msg =  '<fmt:message code="main.th.NonConformity" />'
        }
        var prcsOut = prcsout||'';
        var prcsOutSet = prcsoutSet||'';
        if(prcsOut!=''&&prcsOut.indexOf('\n')>=0){
            var prcsOutArr = prcsOut.split('\n');
        }else{
            var prcsOutArr = [prcsOut];
        }
        if(prcsOutArr.length == 1 && prcsOutSet==''){
            prcsOutSet = '[1]'
        }
        if(prcsOutSet != ""){

            formdata = covertToFormData(formdata);


            prcsOutArr.forEach(function(v,i){
                if(v){
                    if(v.indexOf('"')>=0){
                        v = v.replace(/"/g,"'");
                    }
                    var check_pass = 0;
                    var titleValue = '';
                    var arr_rule = v.split("'");
                    var item_title = myTrim(arr_rule[1]);
                    var item_con = myTrim(arr_rule[2]);
                    var item_value = myTrim(arr_rule[3]);
                    //用来处理 特殊情况单选框控件，无法通过id来选择到元素的情况
                    var item_pag = $(e).find('[Id="'+fromDataReject[item_title]+'"]');
                    if(item_pag.length == 0&&$('[name='+ fromDataReject[item_title] +']').eq(0).attr('data-type') == 'radio'){
                        item_pag = $('input[name='+ fromDataReject[item_title] +']:checked');
                    }
                    if(v.indexOf('[')<=-1){
                        if(item_pag.attr('data-type')=='macros'&&item_pag.attr('datafld')=='SYS_USERNAME'&&item_pag.attr('orgsignImg')==1){
                            if(item_pag.prev().find('img').attr('src')!=undefined&&item_pag.prev().find('img').attr('src')!=''&&item_pag.prev().find('img').attr('src').indexOf('AID')>=0){
                                titleValue = item_pag.prev().find('img').attr('src');
                            }else{
                                titleValue = formdata[fromDataReject[item_title]];
                            }
                        }else{
                            titleValue = formdata[fromDataReject[item_title]];
                            //该判断为下拉菜单为下拉子菜单时，需做特殊判断处理
                            if(titleValue&&titleValue.indexOf('|') > -1&&item_pag.attr('data-type') == 'select'){
                                titleValue = titleValue.split('|')[0];
                            }
                            //该判断为宏部门列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_DEPT'){
                                if(titleValue&&titleValue.indexOf('├') > -1 || titleValue&&titleValue.indexOf('┌') > -1){
                                    titleValue=item_pag.find('option:checked').attr('deptname')
                                }
                            }
                            //该判断为部门人员（本部门）列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_DEPT_PERSON'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏人员列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_USER'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏角色列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_PRIV_ONLY'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏辅助角色列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_PRIV_OTHER'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏流程设置所有经办人列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_PRCSUSER1'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏本步骤设置经办人列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_PRCSUSER2'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏部门主管（本部门）列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_MANAGER1'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏部门主管（上级部门）列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_MANAGER2'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏部门主管（一级部门）列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_MANAGER3'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为宏来自sql查询列表控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'macros'&&item_pag.attr('datafld') == 'SYS_LIST_SQL'){
                                if(titleValue&&titleValue.indexOf('_') > -1){
                                    titleValue = titleValue.split('_')[1];
                                }
                            }
                            //该判断为部门选择控件 和 用户选择控件时，需对titleValue处理
                            else if(item_pag.attr('data-type') == 'deptselect' || item_pag.attr('data-type') == 'userselect'){
                                if(titleValue&&titleValue.indexOf('|')>-1){
                                    titleValue = titleValue.split('|')[1];
                                    if(titleValue.substring(titleValue.length-1,titleValue.length) == ','){
                                        titleValue = titleValue.substring(0,titleValue.length-1);
                                    }
                                }
                            }

                        }

                    }else{
                        if(item_title == '[当前步骤号]' || item_title == '[CUR_PRCS_ID]'){
                            titleValue = dataobj.prcsId
                        }else if(item_title == '[当前主办人姓名]' || item_title == '[CUR_USER_NAME]'){
                            titleValue = dataobj.userName.split('：')[1];
                        }else if(item_title == '[公共附件名称]' || item_title == '[ATTACH_NAME]'){
                            titleValue = '';
                            for(var j=0;j<$(e).find('#oneUploadFile .item_wordH1').length;j++){
                                if($(e).find('#oneUploadFile .item_wordH1').length ==1){
                                    titleValue = GetFileNameNoExt($(e).find('#oneUploadFile .item_wordH1').eq(j).attr('title'))
                                }else{
                                    titleValue += GetFileNameNoExt($(e).find('#oneUploadFile .item_wordH1').eq(j).attr('title')) + ','
                                }
                            }
                        }else if(item_title == '[公共附件个数]' || item_title == '[ATTACH_COUNT]'){
                            titleValue = $(e).find('#oneUploadFile .item_wordH1').length;
                        }else if(item_title == '[当前流程设计步骤号]' || item_title == '[CUR_FLOW_PRCS]'){
                            titleValue = dataobj.flowPrcs
                        }else if(item_title == '[当前主办人角色]' || item_title == '[CUR_USER_PRIV]'){
                            titleValue = attributes.sYS_USERPRIV;
                        }else if(item_title == '[当前主办人角色_辅助角色]' || item_title == '[CUR_USER_PRIV_OTHER]'){
                            var thisd = attributes.SYS_USERPRIVOTHER;
                            if(thisd.substr(thisd.length-1,thisd.length) == ','){
                                thisd = thisd.substr(0,thisd.length-1);
                            }
                            titleValue = thisd;
                        }else if(item_title == '[当前主办人部门]' || item_title == '[CUR_USER_DEPT]'){
                            titleValue = attributes.SYS_DEPTNAME_SHORT;
                        }
                        // else if(item_title == '[当前主办人角色]' || item_title == '[CUR_USER_PRIV]'){
                        //     titleValue = $.cookie('userPrivName')||workForm.tool.MacrosData.data.sYS_USERPRIV;
                        // }else if(item_title == '[当前主办人部门]' || item_title == '[CUR_USER_DEPT]'){
                        //     titleValue = workForm.tool.getMacrosData('SYS_DEPTNAME_SHORT')()
                        // }else if(item_title == '[当前主办人上级部门]' || item_title == '[CUR_USER_DEPT_PARENT]'){
                        //     titleValue = workForm.tool.getMacrosData('SYS_MANAGER2')()
                        // }else if(item_title == '[主办人会签意见]' ||　item_title == '[MAIN_USER_SIGN]'){
                        //     var data = globalData.sign;
                        //     titleValue=""
                        //     if(data!=''&&data!=undefined){
                        //         for(var j=0;j<data.length;j++){
                        //             if(data[j].opFlag == 1){
                        //                 titleValue += data[j].content
                        //             }
                        //         }
                        //     }
                        // }else if(item_title == '[经办人会签意见]' || item_title == '[USER_SIGN]'){
                        //     var data = globalData.sign;
                        //     titleValue=""
                        //     if(data!=''&&data!=undefined){
                        //         for(var j=0;j<data.length;j++){
                        //             if(data[j].opFlag == 0){
                        //                 titleValue += data[j].content
                        //             }
                        //         }
                        //     }
                        //
                        // }
                    }
//                           判断 第二个值是字段还是类型
                    if(fromDataReject[item_value]){//如果是字段并且是表单中字段的话
                        item_value = formdata[fromDataReject[item_value]];
                    }else{
                        if(item_value.indexOf('[')>-1){ //如果是字段并且不是表单中字段
                            if(item_value == '[当前步骤号]' || item_value == '[CUR_PRCS_ID]'){
                                item_value = dataobj.prcsId
                            }else if(item_value == '[当前主办人姓名]' ||item_value == '[CUR_USER_NAME]'){
                                item_value = dataobj.userName.split('：');
                            }else if(item_title == '[公共附件名称]'　|| item_title == '[ATTACH_NAME]'){
                                item_value = item_value;
                            }else if(item_title == '[公共附件个数]' || item_title == '[ATTACH_COUNT]'){
                                item_value = item_value;
                            }else if(item_value == '[当前流程设计步骤号]' || item_value == '[CUR_FLOW_PRCS]'){
                                item_value = dataobj.flowPrcs
                            }else if(item_title == '[当前主办人角色]' || item_title == '[CUR_USER_PRIV]'){
                                item_value = attributes.sYS_USERPRIV;
                            }else if(item_title == '[当前主办人角色_辅助角色]' || item_title == '[CUR_USER_PRIV_OTHER]'){
                                var thisd = attributes.SYS_USERPRIVOTHER;
                                if(thisd.substr(thisd.length-1,thisd.length) == ','){
                                    thisd = thisd.substr(0,thisd.length-1);
                                }
                                item_value = thisd;
                            }else if(item_title == '[当前主办人部门]' || item_title == '[CUR_USER_DEPT]'){
                                item_value = attributes.SYS_DEPTNAME_SHORT;
                            }
                            // else if(item_value == '[当前主办人角色]' || item_value == '[CUR_USER_PRIV]'){
                            //     item_value = $.cookie('userPrivName')||workForm.tool.MacrosData.data.sYS_USERPRIV;
                            // }else if(item_value == '[当前主办人部门]' || item_value == '[CUR_USER_DEPT]'){
                            //     item_value = workForm.tool.getMacrosData('SYS_DEPTNAME_SHORT')()
                            // }else if(item_value == '[当前主办人上级部门]' ||item_value == '[CUR_USER_DEPT_PARENT]'){
                            //     item_value = workForm.tool.getMacrosData('SYS_MANAGER2')()
                            // }else if(item_value == '[主办人会签意见]'　|| item_value == '[MAIN_USER_SIGN]'){
                            //     var data = globalData.sign;
                            //     item_value=""
                            //     for(var j=0;j<data.length;j++){
                            //         if(data[j].opFlag == 1){
                            //             item_value += data[j].content
                            //         }
                            //     }
                            // }else if(item_value == '[经办人会签意见]' ||item_value == '[USER_SIGN]'){
                            //     var data = globalData.sign;
                            //     item_value=""
                            //     for(var j=0;j<data.length;j++){
                            //         if(data[j].opFlag == 0){
                            //             item_value += data[j].content
                            //         }
                            //     }
                            // }
                        }else{ //如果是类型值的话
                            if(item_value == '数值'){
                                item_value = 'shu'
                            }else if(item_value == '日期'){
                                item_value = 'date'
                            }else if(item_value == '时间+日期'){
                                item_value = 'time';
                            }else{
                                item_value = item_value;
                            }
                        }
                    }
                    if(titleValue == undefined){
                        res.msg = '条件设置有误，不存在“'+item_title+'”字段，请联系系统管理员前往流程设计器修改！';
                    }else{
                        //该判断为部门选择控件 且 条件为等于 时，调用judgeResult()方法来判断用户选择框和条件设置框字段是否相同（不论排序）
                        if(item_pag.attr('data-type') == 'deptselect'&&item_con=='='  ||  item_pag.attr('data-type') == 'userselect'&&item_con=='=' ){
                            check_pass=judgeResult(titleValue,item_value)
                        }
                        //该判断为部门选择控件 且 条件为不等于 时，调用judgeResult()方法来判断用户选择框和条件设置框字段是否相同（不论排序）
                        else if(item_pag.attr('data-type') == 'deptselect'&&item_con=='!=' || item_pag.attr('data-type') == 'userselect'&&item_con=='!='){
                            check_pass=!judgeResult(titleValue,item_value)
                        }
                        else{
                            check_pass = checkTileValue(titleValue,item_con,item_value);
                        }
                    }
                    var setitem = (i+1)
                    var reg = new RegExp('\\['+setitem+'\\]',"g");//g,表示全部替换。

                    prcsOutSet = prcsOutSet.replace(reg,check_pass);
                }
            });
            prcsOutSet = covertToPrcsOutSet(prcsOutSet.toLowerCase());
            if(prcsOutSet.indexOf('（') > -1 ||prcsOutSet.indexOf('）') > -1){
                prcsOutSet = prcsOutSet.replace(/\（/g, "(").replace(/\）/g, ")");
            }
            var result = eval(prcsOutSet);
            if(result == 0){
                res.flag = false;
            }
        }
        if(cb){
            cb(res);
        }
    };

    function buildFormData(e){
        var arr = {};
        $(e).find('.form_item').each(function(i,v){
            var _this = $(this);
            arr[_this.attr('title')] = _this.attr('name');
        });
        return arr;

    };
    function checkTileValue(item_value,rule,item_title){
        var checkpass = 0;
        if(item_value != ''){
            if(typeof item_value == 'string'){
                if(item_value.indexOf('-')>-1||item_value.indexOf(':')>-1||item_value.indexOf(',')>-1||item_value.indexOf('|')>-1){
                    var item_value =  item_value
                }else{
                    var item_value = parseFloat(item_value)  || item_value ;
                }
            }else{
                var item_value = parseFloat(item_value)  || item_value ;
            }


        }else{
            var item_value =  item_value;
        }
        if(item_title != ''){
            if(typeof item_title =='string'){
                if(item_title.indexOf('-')>-1||item_title.indexOf(':')>-1){
                    var item_title = item_title
                }else{
                    var item_title =  parseFloat(item_title) || item_title ;
                }
            }else{
                var item_title =  parseFloat(item_title) || item_title ;
            }

        }else{
            var item_title =  item_title;
        }
        var date = /^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;
        var time = /^(((?!0000)[0-9]{4}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)|(0[13578]|1[02])-31)|([0-9]{2}(0[48]|[2468][048]|[13579][26])|(0[48]|[2468][048]|[13579][26])00)-02-29)) (20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d$/


        switch (rule) {
            case '=':
                var reDateTime = /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/;
                if(item_title == 'shu'&&!isNaN(item_value)){
                    checkpass = 1;
                }else if(item_title == 'date'&& /^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/.test(item_value)){
                    checkpass = 1;
                }else if(item_title == 'time'&& !reDateTime.test(item_value)){
                    checkpass = 1;
                }else if (item_title == item_value) {
                    checkpass = 1;
                }
                break;
            case '!=':
                var reDateTime = /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/;
                if(item_title == 'shu'&&isNaN(item_value)){
                    checkpass = 1;
                }else if(item_title == 'date'&& !/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/.test(item_value)){
                    checkpass = 1;
                }else if(item_title == 'time'&& reDateTime.test(item_value)){
                    checkpass = 1;
                }else if (item_title != item_value) {
                    checkpass = 1;
                }
                break;
            case '<>':
                if(date.test(item_title) && date.test(item_value)){
                    if(new Date(item_title.replace(/-/g, "/")).getTime()!=new Date(item_value.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if(time.test(item_title) && time.test(item_value)){
                    if(new Date(item_title.replace(/-/g, "/")).getTime()!=new Date(item_value.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if (item_title != item_value) {
                    checkpass = 1;
                }
                break;
            case '>':
                if(date.test(item_title) && date.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()>new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if(time.test(item_title) && time.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()>new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if ( item_value >  item_title) {
                    checkpass = 1;
                }
                break;
            case '<':
                if(date.test(item_title) && date.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()<new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if(time.test(item_title) && time.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()<new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if (item_value < item_title) {
                    checkpass = 1;
                }
                break;
            case '<=':
                if(date.test(item_title) && date.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()<=new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if(time.test(item_title) && time.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()<=new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if (item_value <=  item_title) {
                    checkpass = 1;
                }
                break;
            case '>=':
                if(date.test(item_title) && date.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()>=new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if(time.test(item_title) && time.test(item_value)){
                    if(new Date(item_value.replace(/-/g, "/")).getTime()>=new Date(item_title.replace(/-/g, "/")).getTime()){
                        checkpass = 1;
                    }
                }else if (item_value >=  item_title) {
                    checkpass = 1;
                }
                break;
            case 'include':
                if(item_value==''){
                    if(item_title==''){
                        checkpass = 1;
                    }
                }else{
                    item_value = String(item_value);
                    if (item_value.indexOf(item_title) > -1) {
                        checkpass = 1;
                    }
                }
                break;
            case 'exclude':
                if(item_value==''){
                    if(item_title==''){
                        checkpass = 1;
                    }
                }else{
                    item_value = String(item_value);
                    if(item_value!=''){
                        if (item_value.indexOf(item_title) == -1) {
                            checkpass = 1;
                        }
                    }
                }
                break;
        }
        return checkpass;
    };



 $(document).on('click','.editAndDelete0',function () {//转交
     var dataObject=pageObj.arrs[$(this).attr('data-i')];
     $.ajax({
         type: 'get',
         url: '/syspara/queryOrgScope',
         dataType: 'json',
         success: function (reg) {
             var item = reg.object;
             var deptNo = '';
             if(item.paraValue == 1){
                 paraValue = 1;
                 $.ajax({
                     url:'/getUserOrg',
                     dataType:'json',
                     async: false,
                     type:'get',
                     success:function(res){
                         if(res.flag&&res.obj.length>0){
                             for(var i=0;i<res.obj.length;i++){
                                 deptNo += res.obj[i].deptNo +','
                             }
                         }
                         deptNo = deptNo;
                     }
                 })

             }else{
                 deptNo = ''
             }
             $.ajax({
                 url:'/WorkFlowSelectBranch/getBranch?flowId='+dataObject.flowId+'&runId='+dataObject.runId+'&currentFlowPrcs='+dataObject.flowPrcs+'&deptNo='+deptNo,
                 type:'get',
                 dataType:'json',
                 success:function(result){
                     //解析表单内容
                    var attributes = result.attributes.html;
                    var formDataObj = buildFormData(attributes)
                     var realData=[];
                     var form_item=$(attributes).find('.form_item');

                     $.ajax({
                         url:'/workflow/work/selectFlowData',
                         data:{flowId:dataObject.flowId,runId:dataObject.runId},
                         type:'get',
                         dataType:'json',
                         success:function(opt){
                             if(opt.msg=='NO DATA'){
                                 if(result.attributes.conditionDesc!=undefined&&result.attributes.conditionDesc!=''){
                                     $.layerMsg({content:result.attributes.conditionDesc,icon:'2'})
                                 }else{
                                     $.layerMsg({content:'不符合条件！',icon:'2'})
                                 }
                                return false;
                             }
                             for(var i=0;i<form_item.length;i++){
                                 var baseData={};
                                 var obj = form_item.eq(i);
                                 var key = obj.attr("name");
                                 baseData.key = key;
                                 baseData.value = opt.obj[key];
                                 if(opt.obj[key] == undefined){
                                     baseData.value = opt.obj[key.toLowerCase()];
                                     if(opt.obj[key.toLowerCase()] == undefined){
                                         baseData.value = '';
                                     }
                                 }
                                 realData.push(baseData);
                             }
                            checkPrcOut(attributes,dataObject,result.attributes,result.attributes.prcsOut,result.attributes.prcsOutSet,result.attributes.conditionDesc,realData,formDataObj,function(flag){
                                if(flag.flag){
                                    var title=''
                                    var prcsName = ''
                                    var workList = ''
                                    if(result.obj.length<1){
                                        prcsName+='<div title="结束流程" class="prcsName prcsName_chang" style="" ><h1 >结束流程</h1></div>';
                                    }
                                    for(var i=0;i<result.obj.length;i++){
                                        var autoTypelist=result.obj[i].autoTypelist;
                                        title=result.obj[i].prcsName;
                                        if(result.obj[i].prcsIn != undefined){
                                           checkPrcIn(attributes,dataObject,result.attributes,result.obj[i].prcsIn,result.obj[i].prcsInSet,result.obj[i].conditionDesc,realData,formDataObj,function(flags){
                                            if(flags.flag){
                                                prcsName+='<div title="'+result.obj[i].prcsName+'" class="prcsName" flag="1" style="" prcsId='+result.obj[i].flowPrcs+'><h1 >'+result.obj[i].prcsName+'</h1></div>';
                                                var zhubanren = '';
                                                var zhubanId = ''
                                                var jingbanren = '';
                                                var jingbanId = ''
                                                var zhubanpriv='';
                                                var jingbanpriv='';
                                                var zhubandept='';
                                                var jingbandept=''
                                                var userLock = result.obj[i].userLock
                                                if(userLock == 0){
                                                    var color='#333'
                                                }else{
                                                    var color='blue'
                                                }
                                                if(autoTypelist.length>0){

                                                    for(var j=0;j<autoTypelist.length;j++){

                                                        if(autoTypelist[j].opFlag==1){
                                                            zhubanren += autoTypelist[j].userName+','
                                                            zhubanId +=  autoTypelist[j].userId+','
                                                            jingbanren += autoTypelist[j].userName+','
                                                            jingbanId +=  autoTypelist[j].userId+','
                                                            zhubanpriv += autoTypelist[j].userPrivName+','
                                                            zhubandept += autoTypelist[j].deptName+','
                                                            jingbanpriv += autoTypelist[j].userPrivName+','
                                                            jingbandept += autoTypelist[j].deptName+','
                                                        }else{
                                                            jingbanren += autoTypelist[j].userName+','
                                                            jingbanId +=  autoTypelist[j].userId+','
                                                            jingbanpriv += autoTypelist[j].userPrivName+','
                                                            jingbandept += autoTypelist[j].deptName+','
                                                        }
                                                    }

                                                }

                                                workList += '<li class="workflow-node-result clearfix " id="workflow-node'+result.obj[i].flowPrcs+'" style="display:none">' +
                                                    '<div class="chooseUser"><span class="workflow-node-sp">'+result.obj[i].prcsName+'</span><input type="button" pid="'+result.obj[i].flowPrcs+'" topdefault="'+result.obj[i].topDefault+'" id="chooseUser" class="chooseUsers" value=""></div>'+
                                                    '<div class="text"><div class="zhu">' +function(){
                                                        if(result.obj[i].topDefault==0){
                                                            return  '<a href="javascript:;" class="sponsor" style="color:'+color+'"><fmt:message code="sup.th.Sponsor"/></a><a style="display:inline-block;margin-top: 4px;">:</a><textarea pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }else if(result.obj[i].topDefault==1){
                                                            return  '<a href="javascript:;"  class="sponsor" style="color:'+color+'">先接收者为主办</a><a style="display:inline-block;margin-top: 4px;">:</a><textarea style="display:none" pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }else{
                                                            return  '<a href="javascript:;"  class="sponsor" style="color:'+color+'">无主办会签</a><a style="display:inline-block;margin-top: 4px;">:</a><textarea style="display:none" pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }
                                                    }()+ '<div class="attach_div small TOP_FLAG_SHOW2_menu"  pid="'+result.obj[i].flowPrcs+'" style="display: none; top: 24px; left: 170px;position:absolute;background:#fff;">' +
                                                    '                                                        <a href="javascript:void(0);" style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="sup.th.Sponsor" /></a>' +
                                                    '                                                        <a href="javascript:void(0);" style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="main.th.FirstReceiverHosting" /></a><a href="javascript:void(0); " style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="workflow.th.NoSponsorWillSign" /></a></div>' +
                                                    '</div><div class="jing"><a href="javascript:;" style="color:#333"><fmt:message code="workflow.th.Manager"/>:</a><textarea pid="'+result.obj[i].flowPrcs+'" readonly="readonly" name="" user_id="'+jingbanId+'" userPrivName="'+jingbanpriv+'" deptName="'+jingbandept+'" value="'+jingbanren+'" class="jingban_name" id="jingban_name'+result.obj[i].flowPrcs+'" >'+jingbanren+'</textarea></div></div>'+
                                                    '</li>'
                                            }else{
                                                prcsName+='<div title="'+result.obj[i].prcsName+'" class="prcsName" style="" flag="0" prcsId='+result.obj[i].flowPrcs+'><span style="display:none">'+result.obj[i].conditionDesc+'</span><h1 >'+result.obj[i].prcsName+'</h1></div>';
                                                var zhubanren = '';
                                                var zhubanId = ''
                                                var jingbanren = '';
                                                var jingbanId = ''
                                                var zhubanpriv='';
                                                var jingbanpriv='';
                                                var zhubandept='';
                                                var jingbandept=''
                                                var userLock = result.obj[i].userLock
                                                if(userLock == 0){
                                                    var color='#333'
                                                }else{
                                                    var color='blue'
                                                }
                                                if(autoTypelist.length>0){
                                                    for(var j=0;j<autoTypelist.length;j++){
                                                        if(autoTypelist[j].opFlag==1){
                                                            zhubanren += autoTypelist[j].userName+','
                                                            zhubanId +=  autoTypelist[j].userId+','
                                                            jingbanren += autoTypelist[j].userName+','
                                                            jingbanId +=  autoTypelist[j].userId+','
                                                            zhubanpriv += autoTypelist[j].userPrivName+','
                                                            zhubandept += autoTypelist[j].deptName+','
                                                            jingbanpriv += autoTypelist[j].userPrivName+','
                                                            jingbandept += autoTypelist[j].deptName+','
                                                        }else{
                                                            jingbanren += autoTypelist[j].userName+','
                                                            jingbanId +=  autoTypelist[j].userId+','
                                                            jingbanpriv += autoTypelist[j].userPrivName+','
                                                            jingbandept += autoTypelist[j].deptName+','
                                                        }
                                                    }
                                                }

                                                workList += '<li class="workflow-node-result clearfix " id="workflow-node'+result.obj[i].flowPrcs+'" style="display:none">' +
                                                    '<div class="chooseUser"><span class="workflow-node-sp">'+result.obj[i].prcsName+'</span><input type="button" pid="'+result.obj[i].flowPrcs+'"  topdefault="'+result.obj[i].topDefault+'" id="chooseUser"  class="chooseUsers" value=""></div>'+
                                                    '<div class="text"><div class="zhu">' +function(){
                                                        if(result.obj[i].topDefault==0){
                                                            return  '<a href="javascript:;" class="sponsor" style="color:'+color+'"><fmt:message code="sup.th.Sponsor"/></a><a style="display:inline-block;margin-top: 4px;">:</a><textarea pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }else if(result.obj[i].topDefault==1){
                                                            return  '<a href="javascript:;"  class="sponsor" style="color:'+color+'">先接收者为主办</a><a style="display:inline-block;margin-top: 4px;">:</a><textarea style="display:none" pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }else{
                                                            return  '<a href="javascript:;"  class="sponsor" style="color:'+color+'">无主办会签</a><a style="display:inline-block;margin-top: 4px;">:</a><textarea style="display:none" pid="'+result.obj[i].flowPrcs+'" name="" user_id="'+zhubanId+'" userPrivName="'+zhubanpriv+'" deptName="'+zhubandept+'" value="'+zhubanren+'" class="remind_name" id="remind_name'+result.obj[i].flowPrcs+'" >'+zhubanren+'</textarea>'
                                                        }
                                                    }()+'<div class="attach_div small TOP_FLAG_SHOW2_menu"  pid="'+result.obj[i].flowPrcs+'" style="display: none; top: 24px; left: 170px;position:absolute;background:#fff;">' +
                                                    '                                                        <a href="javascript:void(0);" style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="sup.th.Sponsor" /></a>' +
                                                    '                                                        <a href="javascript:void(0);" style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="main.th.FirstReceiverHosting" /></a><a href="javascript:void(0); " style="display:block;text-align:center;padding:0px 5px;line-height:21px;"><fmt:message code="workflow.th.NoSponsorWillSign" /></a></div>' +
                                                    '</div><div class="jing"><a href="javascript:;" style="color:#333"><fmt:message code="workflow.th.Manager"/>:</a><textarea pid="'+result.obj[i].flowPrcs+'" user_id="'+jingbanId+'" value="'+jingbanren+'" userPrivName="'+jingbanpriv+'" deptName="'+jingbandept+'"  name="" class="jingban_name" id="jingban_name'+result.obj[i].flowPrcs+'" >'+jingbanren+'</textarea></div></div>'+
                                                    '</li>'
                                            }
                                            })
                                        }else if(result.obj[i].prcsName == '结束流程'){
                                            prcsName+='<div title="结束流程" class="prcsName" flag="1" style="" prcsId="0"><h1 >结束流程</h1></div>';

                                        }

                                    }


                                    layer.open({
                                        type:1,
                                        offset: '80px',
                                        area: ['930px', '500px'],
                                        // closeBtn: 0,
                                        title:['<fmt:message code="workflow.th.Transfer"/>', 'background-color:#f3f3f3;color:#333'],
                                        btn:['<fmt:message code="global.lang.ok"/>','<fmt:message code="depatement.th.quxiao"/>'],
                                        content: '<div class="content" style="width:94%;margin:0 auto">' +
                                            '<div class="open_title"><img src="/img/gzlnum1.png" style="top: 5px;">' +
                                            '<span style="color: #023964;font-size: 14px;margin-left: 5px">请选择下一步骤:当前步骤为第'+
                                            '<e style="color:red">'+dataObject.prcsId+'</e>步（'+dataObject.flowName+'）</span><span style="color:red">'+dataObject.userName+'</span><span style="color:red">（办理中）</span></div>'+
                                            '<div class="wrap" style="margin:-1px;">' +
                                            '<div class="left"><ul>' +
                                            '<li class="buData">' +
                                            '</li>'+
                                            '</ul></div>'+
                                            '<div class="right"><ul>' +workList+'</ul></div>'+
                                            '</div>'+
                                            '<div class="work-msg-block hide" id="viewbox" style="margin-bottom: 25px;display:none;"><div class="work-msg-title"><img src="/img/gzlnum2.png" style="position: absolute;top: 5px;"><span style="margin-left: 32px;"><fmt:message code="work.th.add" /></span></div><div class="work-msg-content" style="display: block;position: relative;padding: 15px 10px;"><div class="cytitle">传阅人：</div><div class="clearfix" style="margin-left: 122px;"><textarea name="viewUserName" id="viewUserName" dataid="" username="" readonly="" style="width:468px;height: 60px;font-size:12px;border-radius:3px"></textarea>&nbsp;<a class="orgAdd" id="viewUserNameSelect" tarobj = "viewUserName" style="color: #3691da;margin-left: 5px;">选择</a>&nbsp;<a class="orgClear"  tarobj = "viewUserName" id="viewUserNameClear" style="color: #3691da;margin-left: 15px;">清空</a></div></div></div>'+

                                            '<div class="work-msg-title"><img src="/img/gzlnum3.png" style="position: absolute;top: 5px;"><span style="margin-left: 32px;"><fmt:message code="main.th.Sendmessage"/></span></div>'+
                                            '<div>' +
                                            '<div class="msg_content">' +
                                            '<div>' +
                                            '<div data_type="next" class="work-msg-op-title"><div class="gjtitles"><fmt:message code="workflow.th.nextstep" />：</div><span class="addactiveClass sms-check sms-bg sms-bg-static active" style="margin-left: 70px;" data-id="1" title="<fmt:message code="notice.th.remindermessage" />"></span><span class="xuanzhong xuanzhongactive"><fmt:message code="sms.th.remind" /></span><span  class=" mobile-check mobile-bg mobile-bg-static" title="<fmt:message code="main.th.SendSMS" />" style="display:none;"></span>'+
                                            '<span data-id="2" class="addactiveClass email-check email-bg email-bg-static active" title="<fmt:message code="main.th.SendSMS" />"></span><span class="xuanzhong xuanzhong1 xuanzhongactive"><fmt:message code="adding.th.duanxin" /></span>'+
                                            '</div>'+
                                            '<div data_type="create" class="work-msg-op-title" style="width: 254px;"><div class="gjtitles"><fmt:message code="workflow.th.Initiator" />：</div><span data-id="3" class="addactiveClass sms-check sms-bg sms-bg-static" style="margin-left: 60px;" title="<fmt:message code="notice.th.remindermessage" />"></span><span class="xuanzhong" style="left: 87px;"><fmt:message code="sms.th.remind" /></span>'+
                                            '<span class=" mobile-check mobile-bg mobile-bg-static" title="<fmt:message code="main.th.SendSMS" />" style="display:none;"></span>'+
                                            '<span data-id="4" class="addactiveClass email-check email-bg email-bg-static" title="<fmt:message code="main.th.SendSMS" />"></span><span class="xuanzhong xuanzhong1" style="left: 183px;"><fmt:message code="adding.th.duanxin" /></span>' +
                                            '</div>'+
                                            '<div data_type="managers" class="work-msg-op-title" style="margin-right: 0;width:283px;"><div class="gjtitles" ><fmt:message code="doc.th.AllHandlers" />：</div><span data-id="5" class="addactiveClass sms-check sms-bg sms-bg-static" title="<fmt:message code="notice.th.remindermessage" />" style="margin-left: 90px;"></span><span class="xuanzhong" style="    left: 115px;"><fmt:message code="sms.th.remind" /></span> <span class=" mobile-check mobile-bg mobile-bg-static" title="<fmt:message code="main.th.SendSMS" />" style="display:none;"></span>'+
                                            '<span data-id="6" class="addactiveClass email-check email-bg email-bg-static" title="<fmt:message code="main.th.SendSMS" />"></span> <span class="xuanzhong xuanzhong1" style="left: 220px;"><fmt:message code="adding.th.duanxin" /></span>' +
                                            '</div> '+
                                            '<div data_type="circulate" class="work-msg-op-title" style="margin-right: 0;width:286px;display:none"><div class="gjtitles" >传阅人：</div><span data-id="8" class="addactiveClass sms-check sms-bg sms-bg-static active" title="<fmt:message code="notice.th.remindermessage" />" style="margin-left: 70px;"></span><span class="xuanzhong xuanzhongactive" style="    left: 96px;"><fmt:message code="sms.th.remind" /></span> <span class=" mobile-check mobile-bg mobile-bg-static" title="<fmt:message code="main.th.SendSMS" />" style="display:none;"></span>'+
                                            '<span data-id="9" class="addactiveClass email-check email-bg email-bg-static" title="<fmt:message code="main.th.SendSMS" />"></span> <span class="xuanzhong xuanzhong1" style="left: 197px;"><fmt:message code="adding.th.duanxin" /></span>' +
                                            '</div> '+


                                            '</div>'+

                                            <%--'<div class="tix_jingban" style="margin: 10px 0px;"><fmt:message code="main.th.RemindHandler"/>:<textarea name="" style="width: 490px;height: 50px" id="jingban" cols="" rows=""></textarea><a href="javascript:;" id="choose" style="padding-left:10px;"><fmt:message code="global.lang.select"/></a> <a href="javascript:;" id="empty"><fmt:message code="global.lang.empty"/></a></div>'+--%>
                                            '<div class="tix_con" style="margin:10px 0px;"><fmt:message code="main.th.ReminderContent"/>：<textarea class="conText" type="text" style="width: 76%;border-radius:3px;height: 50px;vertical-align: middle;margin-left:50px;">您有新的工作需要办理，流水号：'+dataObject.runId+'，工作名称/文号：'+dataObject.runName+'</textarea></div>'+
                                            '</div>'+
                                            '</div>'+
                                            '</div>',
                                        yes:function(){
                                            var beginUser=[];
                                            var jingbanUser=[];
                                            var pId=[];
                                            var topDefaultStr = ''
                                            for(var i=0;i<$('.workflow-node-result').length;i++){
                                                if($('.workflow-node-result').eq(i).css('display')!='none'){
                                                    var pid= $('.workflow-node-result').eq(i).find('.chooseUsers').attr('pid');
                                                    var topDefault = $('.workflow-node-result').eq(i).find('.chooseUsers').attr('topDefault');
                                                    topDefaultStr += topDefault+',';
                                                    if(topDefault!=1&&topDefault!=2){
                                                        if($('#remind_name'+pid+'').val()==''){
                                                            $.layerMsg({content:'请选择主办人',icon:2});
                                                            return false;
                                                        }else{
                                                            if($('#remind_name'+pid+'').attr('user_id').indexOf(',')>=0){
                                                                beginUser.push($('#remind_name'+pid+'').attr('user_id').split(',')[0])
                                                            }else{
                                                                beginUser.push($('#remind_name'+pid+'').attr('user_id'))
                                                            }
                                                        }
                                                    }
                                                    jingbanUser.push($('#jingban_name'+pid+'').attr('user_id'))
                                                }
                                            }
                                            $('.prcsName_chang').each(function(){
                                                var prcsid = $(this).attr('prcsid');
                                                pId.push(prcsid);
                                            })
                                            var date = new Date().Format('yyyy-MM-dd hh:mm:ss');
                                            if(dataObject.tableName!=undefined){
                                                var tableName = dataObject.tableName
                                            }else{
                                                var tableName = ''
                                            }
                                            if(dataObject.tabId!=undefined){
                                                var tabId = dataObject.tabId
                                            }else{
                                                var tabId = ''
                                            }
                                            var viewUser = $('#viewUserName').attr('user_id') ||'';//传阅人
                                            if($('.prcsName_chang').find('h1').text()=='结束流程'){
                                                savedData={
                                                    userId:dataObject.userId,
                                                    flowId:dataObject.flowId,
                                                    runId:dataObject.runId,
                                                    runName:dataObject.runName,
                                                    beginTime:date,
                                                    beginUser:'',
                                                    prcsId:dataObject.prcsId,
                                                    prcsflag:1,
                                                    flowPrcs:0,
                                                    jingbanUser:'',
                                                    tableName:tableName,
                                                    tabId:tabId,
                                                    currentPrcsId:dataObject.flowPrcs,
                                                    flowStep:dataObject.prcsId,
                                                    viewUser:viewUser,//viewUser
                                                    topDefault:topDefaultStr
                                                }
                                            }else{
                                                savedData={
                                                    userId:dataObject.userId,
                                                    flowId:dataObject.flowId,
                                                    runId:dataObject.runId,
                                                    runName:dataObject.runName,
                                                    beginTime:date,
                                                    beginUser:beginUser.join(','),
                                                    prcsId:dataObject.prcsId,
                                                    flowPrcs:pId.join(','),
                                                    prcsflag:1,
                                                    jingbanUser:jingbanUser.join('|'),
                                                    tableName:tableName,
                                                    tabId:tabId,
                                                    currentPrcsId:dataObject.flowPrcs,
                                                    flowStep:dataObject.prcsId,
                                                    viewUser:viewUser,
                                                    topDefault:topDefaultStr
                                                }
                                            }
                                            var smsTypes=''
                                            var smsTypesArr=$('.addactiveClass');
                                            for(var i=0;i<smsTypesArr.length;i++){
                                                if($(smsTypesArr[i]).parents('.work-msg-op-title').css('display')!='none')
                                                    if($(smsTypesArr[i]).hasClass('active')){
                                                        smsTypes+=$(smsTypesArr[i]).attr('data-id')+','
                                                    }
                                            }
                                            savedData.smsType=smsTypes;
                                            savedData.smsContent=$('.conText').val();

                                            // savedData.orgAdd=$('#remind_others_name').attr('user_id')||'';
                                            $.ajax({
                                                type: "post",
                                                url: "../../workflow/work/saveWork",
                                                dataType: 'JSON',
                                                data: savedData,
                                                success: function (obj) {
                                                    if(obj.flag==true){
                                                        $.layerMsg({content:'<fmt:message code="workflow.turn.ok" />',icon:1},function(){
                                                            layer.closeAll();
                                                            window.location.reload();
                                                        });
                                                    }else{
                                                        $.layerMsg({content:'<fmt:message code="meet.th.SaveFailed" />！',icon:1},function(){
                                                            layer.closeAll();
                                                        });
                                                    }
                                                }
                                            });
                                        },
                                        btn2:function(){

                                        },
                                        success:function(){
                                            $('.buData').html(prcsName)
                                            // $('.workflow-node-sp').html(title);
                                            if(result.attributes.syncDeal==0||result.attributes.syncDeal==1){
                                                $('.prcsName[flag="1"]').eq(0).addClass('prcsName_chang')
                                                var flagpid = $('.prcsName[flag="1"]').eq(0).attr('prcsId')
                                                $('#workflow-node'+flagpid+'').show();
                                            }else{
                                                for(var m=0;m<$('.prcsName[flag="1"]').length;m++){
                                                    if( $('.prcsName[flag="1"]').eq(m).attr('prcsid') != 0){
                                                        $('.prcsName[flag="1"]').eq(m).addClass('prcsName_chang')
                                                        var flagpid = $('.prcsName[flag="1"]').eq(m).attr('prcsId')
                                                        $('#workflow-node'+flagpid+'').show();
                                                    }
                                                }
                                            }

                                            $('.prcsName').click(function(){
                                                var prcspid = $(this).attr('prcsId');
                                                if($(this).attr('flag')==0){
                                                    var strText = $(this).find('span').text();
                                                    if(strText==''){
                                                        $.layerMsg({content:'不符合条件',icon:2});
                                                        return false;
                                                    }else{
                                                        $.layerMsg({content:strText,icon:2});
                                                        return false;
                                                    }
                                                }else{
                                                    if(result.attributes.syncDeal==0){
                                                        if(!$(this).hasClass('prcsName_chang')){
                                                            $(this).addClass('prcsName_chang').siblings().removeClass('prcsName_chang')
                                                            if(prcspid == 0){
                                                                $('.workflow-node-result').hide();
                                                            }else{
                                                                $('#workflow-node'+prcspid+'').show().siblings().hide();
                                                            }
                                                        }
                                                    }else if(result.attributes.syncDeal==1){
                                                        if(prcspid == 0){
                                                            $('.workflow-node-result').hide();
                                                            $(this).addClass('prcsName_chang').siblings().removeClass('prcsName_chang');
                                                        }else{
                                                            if($('.prcsName_chang').length>1){
                                                                if(!$(this).hasClass('prcsName_chang')){
                                                                    $(this).addClass('prcsName_chang')
                                                                    $('#workflow-node'+prcspid+'').show();
                                                                }else{
                                                                    $(this).removeClass('prcsName_chang')
                                                                    $('#workflow-node'+prcspid+'').hide();
                                                                }
                                                            }else{
                                                                if(!$(this).hasClass('prcsName_chang')){
                                                                    if($('.prcsName_chang').attr('prcsid') == 0){
                                                                        $('.prcsName_chang').removeClass('prcsName_chang');
                                                                    }
                                                                    $(this).addClass('prcsName_chang');
                                                                    $('#workflow-node'+prcspid+'').show();
                                                                }
                                                            }
                                                        }

                                                    }
                                                }
                                            })

                                            $.ajax({
                                                url:'/code/getCodeRemind',
                                                type:'get',
                                                datType:'json',
                                                success:function(res){
                                                    for(var i=0;i<res.obj.length;i++){
                                                        if(res.obj[i].codeName == "工作流：提醒流程发起人"||res.obj[i].codeName == "工作流：提醒流程所有人员"||res.obj[i].codeName == "工作流：提醒下一步经办人"){
                                                            if(res.obj[i].codeName == "工作流：提醒下一步经办人"){
                                                                var j = 0;
                                                            }else if(res.obj[i].codeName == "工作流：提醒流程发起人"){
                                                                var j = 1;
                                                            }else if(res.obj[i].codeName == "工作流：提醒流程所有人员"){
                                                                var j = 2;
                                                            }
                                                            if(res.obj[i]!=null&&res.obj[i].isCan==1){
                                                                $('.work-msg-op-title').eq(j).show();
                                                                if(res.obj[i].isRemind==1){
                                                                    $('.work-msg-op-title').eq(j).find('.addactiveClass').eq(0).addClass('active');
                                                                    $('.work-msg-op-title').eq(j).find('.xuanzhong').eq(0).addClass('xuanzhongactive');
                                                                }else{
                                                                    $('.work-msg-op-title').eq(j).find('.addactiveClass').eq(0).removeClass('active');
                                                                    $('.work-msg-op-title').eq(j).find('.xuanzhong').eq(0).removeClass('xuanzhongactive');
                                                                }
                                                                if(res.obj[i].isIphone==1){
                                                                    $('.work-msg-op-title').eq(j).find('.addactiveClass').eq(1).addClass('active');
                                                                    $('.work-msg-op-title').eq(j).find('.xuanzhong').eq(1).addClass('xuanzhongactive');
                                                                }else{
                                                                    $('.work-msg-op-title').eq(j).find('.addactiveClass').eq(1).removeClass('active');
                                                                    $('.work-msg-op-title').eq(j).find('.xuanzhong').eq(1).removeClass('xuanzhongactive');
                                                                }
                                                            }else{
                                                                $('.work-msg-op-title').eq(j).hide()
                                                            }
                                                        }

                                                    }
                                                }
                                            })

                                            $('#viewUserNameSelect').click(function(){
                                                user_id = 'viewUserName';
                                                $.popWindow("../../common/selectUser");
                                            });
                                            $('#viewUserNameClear').click(function(){
                                                $('#viewUserName').val('');
                                                $('#viewUserName').attr('username','');
                                                $('#viewUserName').attr('dataid','');
                                                $('#viewUserName').attr('user_id','');
                                                $('#viewUserName').attr('userprivname','');
                                            })

                                            $('.sponsor').mousemove(function(){
                                                $(this).parent().find('.TOP_FLAG_SHOW2_menu').show();
                                            })

                                            $('.attach_div a').mousemove(function(){
                                                $(this).parent().show();
                                            })

                                            $('.attach_div').mouseout(function(e){
                                                e.preventDefault();
                                                $('.attach_div').hide();
                                            })

                                            $('.attach_div a').click(function(){
                                                var _this =  $(this);
                                                var pid = $(this).parent().attr('pid');
                                                var pids = $(this).parents('.workflow-node-result').find('.chooseUsers').attr('pid');
                                                if(pid == pids){
                                                    var index = _this.index();
                                                    var color = $(this).parents('.zhu').find('.sponsor').css('color')
                                                    if(color=='#333'||color == 'rgb(51, 51, 51)'){
                                                        alert('您无权修改主办人相关选项');
                                                        return false;
                                                    }else{
                                                        $(this).parents('.zhu').find('.sponsor').html($(this).html());
                                                        $(this).parents('.workflow-node-result').find('.chooseUsers').attr('topDefault',index)

                                                        if(index == 1 || index == 2){
                                                            $(this).parents('.workflow-node-result').find('#remind_name'+pids).hide();
                                                        }else{
                                                            $(this).parents('.workflow-node-result').find('#remind_name'+pids).show();
                                                        }
                                                        $('.TOP_FLAG_SHOW2_menu').hide();
                                                    }

                                                }
                                            })

                                            $(document).on('click','.addactiveClass',function(e){
                                                e.stopPropagation();
                                                if($(this).hasClass('active')){
                                                    $(this).removeClass('active');
                                                    $(this).next().removeClass('xuanzhongactive');
                                                }else {
                                                    $(this).addClass('active');
                                                    $(this).next().addClass('xuanzhongactive');
                                                }
                                            })
                                            $(document).on('click','.xuanzhong',function(e){
                                                e.stopPropagation();
                                                if($(this).hasClass('xuanzhongactive')){
                                                    $(this).prev().removeClass('active');
                                                    $(this).removeClass('xuanzhongactive');
                                                }else {
                                                    $(this).prev().addClass('active');
                                                    $(this).addClass('xuanzhongactive');
                                                }
                                            })
                                            //调取选人控件
                                            $('.chooseUsers').on('click',function(){
                                                var pid = $(this).attr('pid');
                                                var topdefault = $(this).attr('topdefault');
                                                UserItemMain = 'remind_name'+pid;
                                                UserItem = 'jingban_name'+pid;
                                                // var option = flowSelectAutoList[pid];
                                                allprcsUserlist = '';
                                                prcsPrivlist = '';
                                                prcsUserlist = '';
                                                prcsDeptlist = '';
                                                // if($(this).parents('.workflow-node-result').hasClass('SonFlowID')){
                                                //     $.popWindow("/common/selectUserWorkFlowNew?topdefault="+topdefault+"&flowId="+$(this).parents('.workflow-node-result').attr('childflow')+"&deptNo=&flowPrcs=1");
                                                //
                                                // }else{
                                                //     if($(this).hasClass('fatherSonFlow')){
                                                //         $.popWindow("/common/selectUserWorkFlowNew?topdefault="+topdefault+"&flowId="+$(this).attr('flowid')+"&deptNo=&flowPrcs="+pid);
                                                //
                                                //     }else{
                                                $.popWindow("/common/selectUserWorkFlowNew?topdefault="+topdefault+"&flowId="+dataObject.flowId+"&deptNo="+deptNo+"&flowPrcs="+pid);
                                                //
                                                //     }
                                                // }

                                            });
                                            //    点击选择提醒经办人
                                            $('#choose').click(function(){
                                                user_id='jingban';
                                                $.popWindow('../../common/selectUser');
                                            })
                                            //    点击清空提醒指定步骤经办人
                                            $('#empty').click(function(){
                                                $('#jingban').val('');
                                                $('#jingban').attr('dataid','');
                                                $('#jingban').attr('username','');
                                                $('#jingban').attr('user_id','');
                                                $('#jingban').attr('userprivname','');
                                            })
                                            //    点击铃铛
                                            $('.sms-bg-static').click(function(){
                                                if($(this).attr('data-type')=='no'){
                                                    $(this).addClass('showLing');
                                                    $(this).attr('data-type','yes')
                                                }else{
                                                    $(this).removeClass('showLing');
                                                    $(this).attr('data-type','no')
                                                }
                                            })
                                            //    点击email
                                            $('.email-bg-static').click(function(){
                                                if($(this).attr('data-type')=='no'){
                                                    $(this).addClass('showEmail');
                                                    $(this).attr('data-type','yes')
                                                }else{
                                                    $(this).removeClass('showEmail');
                                                    $(this).attr('data-type','no')
                                                }
                                            })
                                        }

                                    })
                                }else{

                                    $.layerMsg({content:flag.msg,icon:2});
                                    return false;
                                }
                            })


                         }
                     })








                 }
             })
         }
     })

    })
</script>